package e.odbo.data.model.smaple;

import e.odbo.data.generator.Generator;
import e.odbo.data.model.Column;
import static e.odbo.data.model.ColumnType.*;
import e.odbo.data.model.I_ColumnGather;

public class PK {
    public final static int TABLE_FLAG_PK=0x01;
    public final static String Column_Name="ID";

    public  final static int TABLE_FLAG_END= UserLogAble.TABLE_FLAG_USERLOG;

    /**
    public final static int NEXT_FLAG(){
        TABLE_FLAG_NEXT=TABLE_FLAG_NEXT<<1;
        return TABLE_FLAG_NEXT;
    }**/

    public static I_ColumnGather PK_String=new I_ColumnGather() {
        @Override
        public Column[] getColumns() {
            return new Column[]{Column.c(Column_Name, VARCHAR(255)).PK()};
        }

        @Override
        public int addTableFlags() {
            return TABLE_FLAG_PK;
        }
    };

    public static I_ColumnGather PK_Int=new I_ColumnGather() {
        @Override
        public Column[] getColumns() {
            return new Column[]{Column.c(Column_Name, INT).PK()};
        }
        @Override
        public int addTableFlags() {
            return TABLE_FLAG_PK;
        }
    };

    public static I_ColumnGather PK_Long=new I_ColumnGather() {
        @Override
        public Column[] getColumns() {
            return new Column[]{Column.c(Column_Name, LONG).PK()};
        }
        @Override
        public int addTableFlags() {
            return TABLE_FLAG_PK;
        }
    };

    public static I_ColumnGather PK_UUID=new I_ColumnGather() {
        @Override
        public Column[] getColumns() {
            return new Column[]{Column.c(Column_Name, VARCHAR(255).defaultGenerator(Generator.UUID)).PK()};
        }

        @Override
        public int addTableFlags() {
            return TABLE_FLAG_PK;
        }
    };
}
